package com.sojson.dao.impl;

import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.sojson.base.impl.BaseDaoImpl;
import com.sojson.dao.BalanceLogDao;
import com.sojson.entity.po.BalanceLog;
import com.sojson.entity.vo.BalanceLogVo;

/**
 * 佣金记录表Dao实现类(目的:把分页插件从Service层分离,这样就不用每次调Dao接口都要分页)
 * 
 * @author liu
 * @date 2021-03-16
 */
@Repository
public class BalanceLogDaoImpl extends BaseDaoImpl<BalanceLogDao, BalanceLog> implements BalanceLogDao {

    @Resource
    private BalanceLogDao balanceLogDao;

    /**
     * 单条插入
     * 
     * @param balanceLog
     * @return
     * @throws SQLException
     */
    @Override
    public int insert(BalanceLog balanceLog) {
        return balanceLogDao.insert(balanceLog);
    }

    /**
     * 批量插入
     * 
     * @param balanceLog
     * @return
     * @throws SQLException
     */
    @Override
    public int insertList(List<BalanceLog> balanceLogs) {
        return balanceLogDao.insertList(balanceLogs);
    }

    /**
     * 通过对象批量删除(物理删除)
     * 
     * @param balanceLog
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteByDto(BalanceLog balanceLog) {
        return balanceLogDao.deleteByDto(balanceLog);
    }

    /**
     * 统计全部数量
     * 
     * @return
     * @throws SQLException
     */
    @Override
    public int countAll() {
        return balanceLogDao.countAll();
    }

    /**
     * 查询所有
     * 
     * @return
     * @throws SQLException
     */
    @Override
    public List<BalanceLog> listAll() {
        return balanceLogDao.listAll();
    }

    /**
     * 根据对象统计数量
     * 
     * @param balanceLog
     * @return
     * @throws SQLException
     */
    @Override
    public int countByDto(BalanceLog balanceLog) {
        return balanceLogDao.countByDto(balanceLog);
    }

    /**
     * 根据对象查询
     * 
     * @param balanceLog
     * @return
     * @throws SQLException
     */
    @Override
    public List<BalanceLog> listByDto(BalanceLog balanceLog) {
        startPageDefaultSort(balanceLog);
        return balanceLogDao.listByDto(balanceLog);
    }

    /**
     * 通过id删除(物理删除)
     * 
     * @param id
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteById(Integer id) {
        return balanceLogDao.deleteById(id);
    }

    /**
     * 通过id列表删除(物理删除)
     * 
     * @param ids
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteByIdList(ArrayList<Integer> ids) {
        return balanceLogDao.deleteByIdList(ids);
    }

    /**
     * 通过id更新(全部更新)
     * 
     * @param balanceLog
     * @return
     * @throws SQLException
     */
    @Override
    public int updateById(BalanceLog balanceLog) {
        return balanceLogDao.updateById(balanceLog);
    }

    /**
     * 通过id列表更新(全部更新)(更新内容相同)
     * 
     * @param balanceLog
     * @return
     * @throws SQLException
     */
    @Override
    public int updateStaticByIdList(BalanceLog balanceLog) {
        return balanceLogDao.updateStaticByIdList(balanceLog);
    }

    /**
     * 通过id列表更新(全部更新)(更新内容不相同)
     * 
     * @param balanceLogs
     * @return
     * @throws SQLException
     */
    @Override
    public int updateChangeByIdList(ArrayList<BalanceLog> balanceLogs) {
        return balanceLogDao.updateChangeByIdList(balanceLogs);
    }

    /**
     * 通过id更新(局部更新)
     * 
     * @param balanceLog
     * @return
     * @throws SQLException
     */
    @Override
    public int updatePartialById(BalanceLog balanceLog) {
        return balanceLogDao.updatePartialById(balanceLog);
    }

    /**
     * 通过id列表更新(局部更新)(更新内容相同)
     * 
     * @param balanceLog
     * @return
     * @throws SQLException
     */
    @Override
    public int updateStaticPartialByIdList(BalanceLog balanceLog) {
        return balanceLogDao.updateStaticPartialByIdList(balanceLog);
    }

    /**
     * 通过id列表更新(局部更新)(更新内容不相同)
     * 
     * @param balanceLogs
     * @return
     * @throws SQLException
     */
    @Override
    public int updateChangePartialByIdList(ArrayList<BalanceLog> balanceLogs) {
        return balanceLogDao.updateChangePartialByIdList(balanceLogs);
    }

    /**
     * 通过id查询
     * 
     * @param id
     * @return
     * @throws SQLException
     */
    @Override
    public BalanceLog findById(Integer id) {
        return balanceLogDao.findById(id);
    }

    /**
     * 通过id列表查询
     * 
     * @param ids
     * @return
     * @throws SQLException
     */
    @Override
    public ArrayList<BalanceLog> findByIdList(ArrayList<Integer> ids) {
        return balanceLogDao.findByIdList(ids);
    }

    /**
     * 通过对象查询id列表
     * 
     * @param balanceLog
     * @return
     * @throws SQLException
     */
    @Override
    public ArrayList<Integer> findIdByDto(BalanceLog balanceLog) {
        return balanceLogDao.findIdByDto(balanceLog);
    }

    /**
     * 清空数据(物理清空)
     * 
     * @throws SQLException
     */
    @Override
    public void clear() {
        balanceLogDao.clear();
    }

    /**
     * 根据对象查询推广列表
     * 
     * @param balanceLog
     * @return
     * @throws SQLException
     */
    @Override
    public List<BalanceLogVo> findRegisterByDto(BalanceLogVo balanceLog) {
        startPageDefaultSort(balanceLog);
        return balanceLogDao.findRegisterByDto(balanceLog);
    }

    /**
     * 根据对象查询分销列表
     * 
     * @param balanceLog
     * @return
     * @throws SQLException
     */
    @Override
    public List<BalanceLogVo> findDivideByDto(BalanceLogVo balanceLog) {
        startPageDefaultSort(balanceLog);
        return balanceLogDao.findDivideByDto(balanceLog);
    }

    /**
     * 根据对象统计余额
     * 
     * @param balanceLog
     * @return
     * @throws SQLException
     */
    @Override
    public BigDecimal sumBalance(BalanceLogVo balanceLog) {
        return balanceLogDao.sumBalance(balanceLog);
    }

    /**
     * 根据对象查询
     * 
     * @param balanceLog
     * @return
     * @throws SQLException
     */
    @Override
    public List<BalanceLogVo> findSjByDto(BalanceLog balanceLog) {
        startPageDefaultSort(balanceLog);
        return balanceLogDao.findSjByDto(balanceLog);
    }

    /**
     * 根据对象查询
     * 
     * @param balanceLog
     * @return
     * @throws SQLException
     */
    @Override
    public List<BalanceLog> findXcxByDto(BalanceLog balanceLog) {
        startPageDefaultSort(balanceLog);
        return balanceLogDao.findXcxByDto(balanceLog);
    }

    /**
     * 根据对象查询
     * 
     * @param balanceLog
     * @return
     * @throws SQLException
     */
    @Override
    public List<BalanceLogVo> list(BalanceLog balanceLog) {
        startPageDefaultSort(balanceLog);
        return balanceLogDao.list(balanceLog);
    }

}